<template>
	<view class="search" :style="{background:bgColor}"> 
		<u-search @click="jumpPage" @search="search" @clear="clearGoods" @custom="search" :action-style="actionStyle" :showAction="showAction" :disabled="disabled" input-align="center" shape="square" placeholder="请输入内容" :show-action="false" v-model="keyword"></u-search>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		props: {
		  bgColor: {
		    type: String
		  },
		  disabled: {
		    type: Boolean
		  },
		  showAction: {
		    type: Boolean
		  }
		},
		data() {
			return {
				keyword: '',
				actionStyle:{
					color:"#fff"
				}
			}
		},
		methods: {
			jumpPage(){
				uni.navigateTo({
				  url: '/pages/views/search?index=1'
				});
			},
			search(value){ 
				if(value==''){
					this.$refs.uToast.show({title: '请输入要搜索的内容'});
					return;
				}
				this.$emit('select-goods',value);
			},
			clearGoods(){
				this.$emit('select-clear');
			}
		}
	}
</script>

<style>
	.search{
		padding: 20rpx 20rpx;
	}
</style>
